/*
 * 
 * LegendShop 多用户商城系统
 * 
 *  版权所有,并保留所有权利。
 * 
 */
package com.legendshop.oa.service.impl;

import java.util.List;

import com.legendshop.dao.support.CriteriaQuery;
import com.legendshop.dao.support.PageSupport;
import com.legendshop.oa.dao.ProjectMemberDao;
import com.legendshop.oa.model.ProjectMember;
import com.legendshop.oa.service.ProjectMemberService;
import com.legendshop.util.AppUtils;

/**
 * The Class ProjectMemberServiceImpl. 服务实现类
 */
public class ProjectMemberServiceImpl implements ProjectMemberService {

	/**
	 *
	 * 引用的Dao接口
	 */
	private ProjectMemberDao projectMemberDao;

	public void setProjectMemberDao(ProjectMemberDao projectMemberDao) {
		this.projectMemberDao = projectMemberDao;
	}

	/**
	 * 根据商城获取列表
	 */
	public List<ProjectMember> getProjectMember(String userName) {
		return projectMemberDao.getProjectMember(userName);
	}

	/**
	 * 根据Id获取
	 */
	public ProjectMember getProjectMember(Long id) {
		return projectMemberDao.getProjectMember(id);
	}

	/**
	 * 删除
	 */
	public void deleteProjectMember(ProjectMember projectMember) {
		projectMemberDao.deleteProjectMember(projectMember);
	}

	/**
	 * 保存
	 */
	public Long saveProjectMember(ProjectMember projectMember) {
		if (!AppUtils.isBlank(projectMember.getId())) {
			updateProjectMember(projectMember);
			return projectMember.getId();
		}
		return projectMemberDao.saveProjectMember(projectMember);
	}

	@Override
	public Long saveProjectMember(Long projectId, List<ProjectMember> projectMember) {
		return projectMemberDao.saveProjectMember(projectId, projectMember);
	}

	/**
	 * 更新
	 */
	public void updateProjectMember(ProjectMember projectMember) {
		projectMemberDao.updateProjectMember(projectMember);
	}

	@Override
	public PageSupport<ProjectMember> getProjectMemberByProject(Long projectId, String memberName, String curPageNO) {
		return projectMemberDao.getProjectMemberByProject(projectId,memberName,curPageNO);
	}

	@Override
	public List<ProjectMember> getProjectBatchMemberByProject(Long projectId) {
		return projectMemberDao.getProjectBatchMemberByProject(projectId);
	}

	@Override
	public boolean isMemberInProject(String username, Long projectId) {
		return projectMemberDao.isMemberInProject(username, projectId);
	}

}
